package com.zero.rpc.provider;

import com.zero.rpc.common.service.UserService;
import com.zero.rpc.core.config.RpcConfig;
import com.zero.rpc.core.constant.RpcConstant;
import com.zero.rpc.core.registry.LocalRegistry;
import com.zero.rpc.core.server.HttpServer;
import com.zero.rpc.core.server.VertxHttpServer;
import com.zero.rpc.core.utils.ConfigUtils;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class EasyProviderMain {
    public static void main(String[] args) {

        RpcConfig rpcConfig = ConfigUtils.loadConfig(RpcConfig.class, RpcConstant.DEFAULT_CONFIG_PREFIX);

        // 注册服务
        LocalRegistry.register(UserService.class.getName(), UserServiceImpl.class);

        // 启动 web 服务
        HttpServer httpServer = new VertxHttpServer();
        httpServer.doStart(rpcConfig.getServerPort());
    }
}
